import { tryOnScopeDispose } from '@vueuse/shared'
import useCanvas from '@views/fabric/Canvas/useCanvas';

export function useCanvasEvent(eventName, handler) {
  const [canvas] = useCanvas();
  canvas.on(eventName, handler);
  const stop = () => {
      canvas.off(eventName, handler);
  };
  tryOnScopeDispose(stop);
  return stop;
}